package com.xy.nio;

import java.nio.IntBuffer;

public class BasicBuffer {
    public static void main(String[] args) {
        IntBuffer buffer = IntBuffer.allocate(5);
        for (int i = 0; i < buffer.capacity(); i++) {
            buffer.put(i );
        }
        buffer.flip();
        buffer.limit(3);
        while (buffer.hasRemaining()) {
            System.out.println(buffer.get());
        }
    }
}
